﻿using System;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Electrical;
using Autodesk.Revit.UI.Selection;

namespace YArchitech.MEP.Electric.CableLay
{
	public class SelectionCableTrayFilter : ISelectionFilter
	{
		public SelectionCableTrayFilter(string systemType)
		{
			this.m_systemType = systemType;
		}

		public bool AllowElement(Element element)
		{
			if (!(element is CableTray))
			{
				return false;
			}
			CableTray cableTray = element as CableTray;
			return cableTray != null && cableTray.get_Parameter(BuiltInParameter.RBS_CTC_SERVICE_TYPE).AsString().Trim() == this.m_systemType.Trim();
		}

		public bool AllowReference(Reference refer, XYZ point)
		{
			return false;
		}

		private string m_systemType = string.Empty;
	}
}
